package org.melanesia.sql.exceptions;

/**
 * Throws when there is a failure during data binding attempt. A
 * "data binding attempt" is a situation when specific data (an object, or a
 * simple type) is converted and assigned to: - a java bean property (the data
 * is then the result of a query) - a sql statement (the java is then the query
 * parameter)
 *
 * @author marcin.kielar
 */
public class DataBindingException extends Exception {

    /** Serial version uid for serialization. */
    private static final long serialVersionUID = -4920995593144121797L;

    /**
     * Constructs {@link DataBindingException} with property name and a cause.
     *
     * @param propertyName
     *            property name
     * @param cause
     *            the cause
     */
    public DataBindingException(final String propertyName, final Throwable cause) {
        super("Binding error for \"" + propertyName + "\": " + cause.getMessage(), cause);
    }
}
